# From: http://www.panda3d.org/forums/viewtopic.php?t=2487&postdays=0&postorder=asc&start=30
# courtesy of steego with mods by gomtuu plus some additions of my own

import wx

import pvis
import pvis.pwx

class MyFrame(pvis.pwx.PandaFrame):
    def __init__(self, *args, **kwargs):
        pvis.pwx.PandaFrame.__init__(self, *args, **kwargs)

        # Put up some graphics
        pvis.arrow(pos=(0,0,0), q=pvis.xAxis, shaftwidth=0.1, color=(1,0,0))
        pvis.arrow(pos=(0,0,0), q=pvis.yAxis, shaftwidth=0.1, color=(0,1,0))
        pvis.arrow(pos=(0,0,0), q=pvis.zAxis, shaftwidth=0.1, color=(0,0,1))
        pvis.sphere(pos=(0,0,0), radius = 0.1)

        # StatusBar
        self.CreateStatusBar()

        # Filemenu
        filemenu = wx.Menu()

        # Filemenu - About
        menuitem = filemenu.Append(-1, "&About", "Information about this program")
        self.Bind(wx.EVT_MENU, self.OnAbout, menuitem) # here comes the event-handler
        # Filemenu - Separator
        filemenu.AppendSeparator()

        # Filemenu - Exit
        menuitem = filemenu.Append(-1, "E&xit", "Terminate the program")
        self.Bind(wx.EVT_MENU, self.OnExit, menuitem) # here comes the event-handler

        # Menubar
        menubar = wx.MenuBar()
        menubar.Append(filemenu,"&File")
        self.SetMenuBar(menubar)

    def OnAbout(self,event):
        message = "Using Panda3d in wxPython"
        caption = "About Pand3d + wxPython Example"
        wx.MessageBox(message, caption, wx.OK)

    def OnExit(self,event):
        self.Close(True)  # Close the frame.
                       
class MyApp(pvis.pwx.PandaApp):
    def __init__(self):
        pvis.pwx.PandaApp.__init__(self)
        self.frame = MyFrame(None, wx.ID_ANY, 'Panda App')


app = MyApp()
pvis.Run()
